<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * 
 *
 * @author kaito
 */
class Style_model extends Xt_model{
    
    protected $mTable = 'style';
    
    // 获取后台设定的风格
    public function getShowStyle()
    {
        $where = array('is_show' => '1', 's_style'=>0);
        return $this->get_list($where);
    }
    
    // 获取后台设定的身高
    public function getShowHight()
    {
        $where = array('is_show' => '1', 's_style'=> 1);
        $list = $this->get_list($where);
        // 检查数据
        if (!empty($list)) {
            foreach ($list as $k=>$v) {
                // 替换字符串
                $list[$k]['name'] = str_replace('+', '',$v['name']);
            }
        }
        
        return $list;
    }
    
    // 获取后台设置的地区
    public function getShowCity()
    {
        $where = array('is_show'=> '1', 's_style'=>2);
        $list = $this->get_list($where);
        return $list;
    }
    
    // 获取后台设置的读取数组
    public function getCityStr()
    {
        $nameStr = '';
        $where = array('is_show'=> '1', 's_style'=>2);
        $list = $this->get_list($where);
        if (!empty($list)) {
            foreach ($list as $value) {
                $nameStr .= ",'".$value['name']."市'";
                $nameStr .= ",'".$value['name']."'";
            }
            
            $nameStr = ltrim($nameStr, ',');
        }
        
        return $nameStr;
    }
}
